<!--
 * @Author: maomao
 * @Date: 2021-03-24 18:50:48
 * @Description: 
 * @FilePath: \clientapp\public\index.html
-->
<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body class="dx-viewport">
    <noscript>
      <strong
        >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
        properly without JavaScript enabled. Please enable it to
        continue.</strong
      >
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
  <script>
    var setFont = function() {
      // 获取设备屏幕的宽度
      var html = document.querySelector("html");
      var width = html.clientWidth; // 获取html的宽度
      // 判断一下，width值是否小于1024；是否大于1920
      if (width < 1024) {
        width = 1024;
      }
      if (width > 1920) {
        width = 1920;
      }
      // 计算html的fontSize值
      var fontSize = width / 80 + "px";
      // 设置html元素的font-size
      html.style.fontSize = fontSize;
    };
    setFont(); //自调用先生效

    // 浏览器窗口大小改变的时候，重新设置html的fontSize
    window.onresize = function() {
      setFont();
    };
  </script>
</html>
